]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/global: Don't force active workspace for launch context
authorJulian Sparber <julian@sparber.net>
Mon, 19 Feb 2024 14:15:48 +0000 (15:15 +0100)
committerJulian Sparber <julian@sparber.net>
Wed, 28 Feb 2024 10:28:06 +0000 (11:28 +0100)
Since the launch context may also be used to activate an action on an
running application with an already existing window, which we don't
necessarily want to move to a different workspace, don't set a workspace
for the launch context. If no active window exists for an application
then it will be place on the currently active workspace anyways.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3198>

src/shell-global.c

index c8ad62690a31ccbbd74cc417857a8f99ee3fa97e..c2589fda8504dbfd817af2acd0d93a5cac70e0d7 100644 (file)
@@ -1439,10 +1439,10 @@ shell_global_app_launched_cb (GAppLaunchContext *context,
  * shell_global_create_app_launch_context:
  * @global: A #ShellGlobal
  * @timestamp: the timestamp for the launch (or 0 for current time)
- * @workspace: a workspace index, or -1 to indicate the current one
+ * @workspace: a workspace index, or -1 to indicate no specific one
  *
  * Create a #GAppLaunchContext set up with the correct timestamp, and
- * targeted to activate on the current workspace.
+ * targeted to activate on @workspace.
  *
  * Return value: (transfer full): A new #GAppLaunchContext
  */
@@ -1463,12 +1463,11 @@ shell_global_create_app_launch_context (ShellGlobal *global,
     timestamp = shell_global_get_current_time (global);
   meta_launch_context_set_timestamp (context, timestamp);
 
-  if (workspace < 0)
-    ws = meta_workspace_manager_get_active_workspace (workspace_manager);
-  else
-    ws = meta_workspace_manager_get_workspace_by_index (workspace_manager, workspace);
-
-  meta_launch_context_set_workspace (context, ws);
+  if (workspace > -1)
+    {
+      ws = meta_workspace_manager_get_workspace_by_index (workspace_manager, workspace);
+      meta_launch_context_set_workspace (context, ws);
+    }
 
   g_signal_connect (context,
                     "launched",